package com.ruoyi.wisdom.task;

import com.ruoyi.wisdom.event.PickRecordEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class PickRecordTask extends IotTask{

    @Autowired
    private PickRecordEvent pickRecordEvent;

    @Scheduled(fixedRate = 10000) // 每10秒执行一次
    public void pushTask(){
        pickRecordEvent.push();
    }

    @Scheduled(fixedRate = 10000) // 每10秒执行一次
    public void deleteTask(){
        pickRecordEvent.delete();
    }

    @Scheduled(fixedRate = 10000) // 每10秒执行一次
    public void pushMessageTask(){
        try {
            pickRecordEvent.pushMessage();
        } catch (Exception e) {
            printErrorLog("微信消息推送---异常：" + e.getMessage());
        }
    }
}
